package com.dzx.design.structural.composite;

/**
 * @author dzx
 * @ClassName:
 * @Description: 组合模式
 * @date 2019年08月08日 15:38:13
 */
public class Test {
    public static void main(String[] args){
        CatalogComponent linuxCourse = new Course("linux课程",11);
        CatalogComponent windowsCourse = new Course("windows课程",11);

        CatalogComponent javaCourseCatalog = new CourseCatalog("java课程目录",2);
        CatalogComponent mmallCourse1 = new Course("java电商一期", 55);
        CatalogComponent mmallCourse2 = new Course("java电商二期", 66);
        CatalogComponent designPattern = new Course("java设计模式", 77);

        javaCourseCatalog.add(mmallCourse1);
        javaCourseCatalog.add(mmallCourse2);
        javaCourseCatalog.add(designPattern);

        CatalogComponent imoocMainCourseCatalog = new CourseCatalog("慕课网课程主目录",1);
        imoocMainCourseCatalog.add(linuxCourse);
        imoocMainCourseCatalog.add(windowsCourse);
        imoocMainCourseCatalog.add(javaCourseCatalog);

        imoocMainCourseCatalog.print();
    }
}
